package cn.edu.scau.cmi.yejiancong.multtelo;

import java.util.ArrayList;
import java.util.Random;

public class worrior {

    private static int maxNumOfworrior = 10; 
    
    private static ArrayList<worrior> worriorList = new ArrayList(maxNumOfworrior);
    private static int countNumOfworrior = 0; 
    private String name;
    static {
       
        for (int i = 0; i < maxNumOfworrior; i++) {
        	worriorList.add(new worrior(i+"元帅"));
        }
    }

   
    private worrior(String name) {
        this.name=name;
    }

   
    public static worrior getInstance() {
        Random random = new Random();
        countNumOfworrior = random.nextInt(maxNumOfworrior)%10; 
        return (worrior) worriorList.get(countNumOfworrior);
    }

    
    public static void worriorInfo() {
        System.out.println(worriorList.get(countNumOfworrior));
    }
    


	@Override
    public String  toString() {
		return name;
	}

}